@page "/ChatDeploy"
@using Extension
@inherits BlazorApp.Pages.Common.PageBase

<GridRow >
    <GridCol Span="6">
        <Card Title=@L["Prompt"]>
            <AntList Bordered DataSource="@_data" Size="small">
                <ChildContent Context="item">
                    <ListItem OnClick="@(() => CopyToSearch(item))">
                        <Text Copyable>@item</Text>
                    </ListItem>
                </ChildContent>
            </AntList>
            <TextArea Bordered AutoSize MinRows="20" @bind-Value="@_txtValue" Style="padding-top: 20px"  ></TextArea>
            <Button OnClick="ChatBtnClicked" Type="@ButtonType.Primary">@L["Send"]</Button>
        </Card>
    </GridCol>

    <GridCol Span="12">
        <Card Title="@(_aiName + L["Response"])">
            <Text Copyable>
                @((MarkupString)_advice.ToHtmlDisplay())
            </Text>
        </Card>
    </GridCol>
    <GridCol Span="6">
        <Card Title=@L["Yaml"]>

            <TextArea Bordered AutoSize MinRows="20"  @bind-Value="@_yamlAdvice"></TextArea>
            <Button OnClick="BtnApplyClicked" Type="@ButtonType.Primary">@L["Apply"]</Button>
            <Button Danger="true" Type="@ButtonType.Primary" OnClick="BtnDeleteClicked">@L["Delete"]</Button>
            @if (!string.IsNullOrEmpty(_execResult))
            {
                <Divider Orientation="left" Style="font-weight:bold">@L["Result"]</Divider>
                <div>
                    <p>
                        <Text Copyable>
                            @((MarkupString)_execResult.ToHtmlDisplay())
                        </Text>
                    </p>
                </div>
            }
        </Card>
    </GridCol>
</GridRow>
